\(\int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx\) [879]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (warning: unable to verify)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 309 \[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\frac {a^2 \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-3-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}+\frac {b^2 \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-1-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}-\frac {2 a b \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-2-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2} \sin (e+f x)}{\left (a^2-b^2\right )^2 f} \]

[Out]

a^2*AppellF1(1/2,-3/2-1/2*n,2,3/2,sin(f*x+e)^2,a^2*sin(f*x+e)^2/(a^2-b^2))*cos(f*x+e)*(d*cos(f*x+e))^n*(cos(f*
x+e)^2)^(-1/2-1/2*n)*sin(f*x+e)/(a^2-b^2)^2/f+b^2*AppellF1(1/2,-1/2-1/2*n,2,3/2,sin(f*x+e)^2,a^2*sin(f*x+e)^2/
(a^2-b^2))*cos(f*x+e)*(d*cos(f*x+e))^n*(cos(f*x+e)^2)^(-1/2-1/2*n)*sin(f*x+e)/(a^2-b^2)^2/f-2*a*b*AppellF1(1/2
,-1-1/2*n,2,3/2,sin(f*x+e)^2,a^2*sin(f*x+e)^2/(a^2-b^2))*(d*cos(f*x+e))^n*sin(f*x+e)/(a^2-b^2)^2/f/((cos(f*x+e
)^2)^(1/2*n))

Rubi [A] (verified)

Time = 0.66 (sec) , antiderivative size = 309, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {4349, 3954, 2903, 3268, 440} \[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\frac {a^2 \sin (e+f x) \cos (e+f x) \cos ^2(e+f x)^{\frac {1}{2} (-n-1)} (d \cos (e+f x))^n \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-n-3),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2}+\frac {b^2 \sin (e+f x) \cos (e+f x) \cos ^2(e+f x)^{\frac {1}{2} (-n-1)} (d \cos (e+f x))^n \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-n-1),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2}-\frac {2 a b \sin (e+f x) \cos ^2(e+f x)^{-n/2} (d \cos (e+f x))^n \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-n-2),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right )}{f \left (a^2-b^2\right )^2} \]

[In]

Int[(d*Cos[e + f*x])^n/(a + b*Sec[e + f*x])^2,x]

[Out]

(a^2*AppellF1[1/2, (-3 - n)/2, 2, 3/2, Sin[e + f*x]^2, (a^2*Sin[e + f*x]^2)/(a^2 - b^2)]*Cos[e + f*x]*(d*Cos[e
 + f*x])^n*(Cos[e + f*x]^2)^((-1 - n)/2)*Sin[e + f*x])/((a^2 - b^2)^2*f) + (b^2*AppellF1[1/2, (-1 - n)/2, 2, 3
/2, Sin[e + f*x]^2, (a^2*Sin[e + f*x]^2)/(a^2 - b^2)]*Cos[e + f*x]*(d*Cos[e + f*x])^n*(Cos[e + f*x]^2)^((-1 -
n)/2)*Sin[e + f*x])/((a^2 - b^2)^2*f) - (2*a*b*AppellF1[1/2, (-2 - n)/2, 2, 3/2, Sin[e + f*x]^2, (a^2*Sin[e +
f*x]^2)/(a^2 - b^2)]*(d*Cos[e + f*x])^n*Sin[e + f*x])/((a^2 - b^2)^2*f*(Cos[e + f*x]^2)^(n/2))

Rule 440

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[a^p*c^q*x*AppellF1[1/n, -p,
 -q, 1 + 1/n, (-b)*(x^n/a), (-d)*(x^n/c)], x] /; FreeQ[{a, b, c, d, n, p, q}, x] && NeQ[b*c - a*d, 0] && NeQ[n
, -1] && (IntegerQ[p] || GtQ[a, 0]) && (IntegerQ[q] || GtQ[c, 0])

Rule 2903

Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Int[Expan
dTrig[(d*sin[e + f*x])^n*(1/((a - b*sin[e + f*x])^m/(a^2 - b^2*sin[e + f*x]^2)^m)), x], x] /; FreeQ[{a, b, d,
e, f, n}, x] && NeQ[a^2 - b^2, 0] && ILtQ[m, -1]

Rule 3268

Int[((d_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff
 = FreeFactors[Cos[e + f*x], x]}, Dist[(-ff)*d^(2*IntPart[(m - 1)/2] + 1)*((d*Sin[e + f*x])^(2*FracPart[(m - 1
)/2])/(f*(Sin[e + f*x]^2)^FracPart[(m - 1)/2])), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p,
x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] &&  !IntegerQ[m]

Rule 3954

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Dist[Sin[
e + f*x]^n*(d*Csc[e + f*x])^n, Int[(b + a*Sin[e + f*x])^m/Sin[e + f*x]^(m + n), x], x] /; FreeQ[{a, b, d, e, f
, n}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[m]

Rule 4349

Int[(u_)*((c_.)*sin[(a_.) + (b_.)*(x_)])^(m_.), x_Symbol] :> Dist[(c*Csc[a + b*x])^m*(c*Sin[a + b*x])^m, Int[A
ctivateTrig[u]/(c*Csc[a + b*x])^m, x], x] /; FreeQ[{a, b, c, m}, x] &&  !IntegerQ[m] && KnownSecantIntegrandQ[
u, x]

Rubi steps \begin{align*} \text {integral}& = \left ((d \cos (e+f x))^n (d \sec (e+f x))^n\right ) \int \frac {(d \sec (e+f x))^{-n}}{(a+b \sec (e+f x))^2} \, dx \\ & = \left (\cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{2+n}(e+f x)}{(b+a \cos (e+f x))^2} \, dx \\ & = \left (\cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \left (\frac {b^2 \cos ^{2+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2}-\frac {2 a b \cos ^{3+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2}+\frac {a^2 \cos ^{4+n}(e+f x)}{\left (-b^2+a^2 \cos ^2(e+f x)\right )^2}\right ) \, dx \\ & = \left (a^2 \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{4+n}(e+f x)}{\left (-b^2+a^2 \cos ^2(e+f x)\right )^2} \, dx-\left (2 a b \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{3+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2} \, dx+\left (b^2 \cos ^{-n}(e+f x) (d \cos (e+f x))^n\right ) \int \frac {\cos ^{2+n}(e+f x)}{\left (b^2-a^2 \cos ^2(e+f x)\right )^2} \, dx \\ & = \frac {\left (a^2 \cos ^{2 \left (\frac {1}{2}+\frac {n}{2}\right )-n}(e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{-\frac {1}{2}-\frac {n}{2}}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {3+n}{2}}}{\left (a^2-b^2-a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f}+\frac {\left (b^2 \cos ^{2 \left (\frac {1}{2}+\frac {n}{2}\right )-n}(e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{-\frac {1}{2}-\frac {n}{2}}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {1+n}{2}}}{\left (-a^2+b^2+a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f}-\frac {\left (2 a b (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2}\right ) \text {Subst}\left (\int \frac {\left (1-x^2\right )^{\frac {2+n}{2}}}{\left (-a^2+b^2+a^2 x^2\right )^2} \, dx,x,\sin (e+f x)\right )}{f} \\ & = \frac {a^2 \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-3-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}+\frac {b^2 \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-1-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) \cos (e+f x) (d \cos (e+f x))^n \cos ^2(e+f x)^{\frac {1}{2} (-1-n)} \sin (e+f x)}{\left (a^2-b^2\right )^2 f}-\frac {2 a b \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2} (-2-n),2,\frac {3}{2},\sin ^2(e+f x),\frac {a^2 \sin ^2(e+f x)}{a^2-b^2}\right ) (d \cos (e+f x))^n \cos ^2(e+f x)^{-n/2} \sin (e+f x)}{\left (a^2-b^2\right )^2 f} \\ \end{align*}

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(13974\) vs. \(2(309)=618\).

Time = 51.68 (sec) , antiderivative size = 13974, normalized size of antiderivative = 45.22 \[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\text {Result too large to show} \]

[In]

Integrate[(d*Cos[e + f*x])^n/(a + b*Sec[e + f*x])^2,x]

[Out]

Result too large to show

Maple [F]

\[\int \frac {\left (d \cos \left (f x +e \right )\right )^{n}}{\left (a +b \sec \left (f x +e \right )\right )^{2}}d x\]

[In]

int((d*cos(f*x+e))^n/(a+b*sec(f*x+e))^2,x)

[Out]

int((d*cos(f*x+e))^n/(a+b*sec(f*x+e))^2,x)

Fricas [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\int { \frac {\left (d \cos \left (f x + e\right )\right )^{n}}{{\left (b \sec \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

[In]

integrate((d*cos(f*x+e))^n/(a+b*sec(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((d*cos(f*x + e))^n/(b^2*sec(f*x + e)^2 + 2*a*b*sec(f*x + e) + a^2), x)

Sympy [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\int \frac {\left (d \cos {\left (e + f x \right )}\right )^{n}}{\left (a + b \sec {\left (e + f x \right )}\right )^{2}}\, dx \]

[In]

integrate((d*cos(f*x+e))**n/(a+b*sec(f*x+e))**2,x)

[Out]

Integral((d*cos(e + f*x))**n/(a + b*sec(e + f*x))**2, x)

Maxima [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\int { \frac {\left (d \cos \left (f x + e\right )\right )^{n}}{{\left (b \sec \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

[In]

integrate((d*cos(f*x+e))^n/(a+b*sec(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((d*cos(f*x + e))^n/(b*sec(f*x + e) + a)^2, x)

Giac [F]

\[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\int { \frac {\left (d \cos \left (f x + e\right )\right )^{n}}{{\left (b \sec \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

[In]

integrate((d*cos(f*x+e))^n/(a+b*sec(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*cos(f*x + e))^n/(b*sec(f*x + e) + a)^2, x)

Mupad [F(-1)]

Timed out. \[ \int \frac {(d \cos (e+f x))^n}{(a+b \sec (e+f x))^2} \, dx=\int \frac {{\left (d\,\cos \left (e+f\,x\right )\right )}^n}{{\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2} \,d x \]

[In]

int((d*cos(e + f*x))^n/(a + b/cos(e + f*x))^2,x)

[Out]

int((d*cos(e + f*x))^n/(a + b/cos(e + f*x))^2, x)